<template>
  <div class="facilitySensorSet">
    <div ref="print">
      <!-- 标题 -->
      <el-row class="facilitySensorSet-a height40">
        <span class="height40-span">
          <img :src="image.juxing_Small" alt />
        </span>
        <!-- //施設全体センサー設定 -->
        <span class="height40-span">{{facilityManagement.facilitySensorSet}}</span>
      </el-row>
      <el-row class="facilitySensorSet-b">
        <!-- 传感器设定的form表单 -->
        <el-form
          :model="ruleForm"
          status-icon
          :rules="rules"
          ref="ruleForm"
          label-position="top"
          class="demo-ruleForm"
        >
          <!-- 厕所异常检测时间设置 -->
          <el-row class="facilitySensorSet-b-form">
            <h3>{{facilityManagement.toilet}}</h3>
            <el-col :span="6">
              <el-form-item :label="facilityManagement.foucsTime" prop="foucsTime" ref="foucsTime">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.foucsTime"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeFoucsTime"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.minute}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.warningTime"
                prop="warningTime"
                ref="warningTime"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.warningTime"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeWarningTime"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.minute}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.unusualTime"
                prop="unusualTime"
                ref="unusualTime"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.unusualTime"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeUnusualTime"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.minute}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 室温异常检测设置 -->
          <el-row class="facilitySensorSet-b-form">
            <h3>{{facilityManagement.temperature}}</h3>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.usualtemp"
                prop="tempBottom"
                ref="tempBottom"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.tempBottom"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeTempBottom"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.temperatureC}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="facilityManagement.unusualtemp" prop="tempTop" ref="tempTop">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.tempTop"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeTempTop"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.temperatureC}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="6">
            <el-form-item :label="facilityManagement.checkTime" prop="unusualCheckTime">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-col" :span="8" align="right">{{facilityManagement.settingTime}}</el-col>
                <el-col :span="8"><el-input v-model.trim="ruleForm.unusualCheckTime" autocomplete="off" :disabled="!isEditor"></el-input></el-col>
                <el-col class="facilitySensorSet-b-form-col" :span="6" align="left">{{facilityManagement.second}}</el-col>
              </el-row>
            </el-form-item>
            </el-col>-->
          </el-row>

          <!-- 呼吸数异常检测设置 -->
          <el-row class="facilitySensorSet-b-form">
            <h3>{{facilityManagement.breath}}</h3>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.bottom"
                prop="breathBottom"
                ref="breathBottom"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.breathBottom"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeBreathBottom"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.breathTime}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="facilityManagement.top" prop="breathTop" ref="breathTop">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.breathTop"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeBreathTop"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.breathTime}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 心跳数异常检测设置 -->
          <el-row class="facilitySensorSet-b-form">
            <h3>{{facilityManagement.heartbeat}}</h3>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.bottom"
                prop="heartbeatBottom"
                ref="heartbeatBottom"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.heartbeatBottom"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeHeartbeatBottom"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.heartTime}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="facilityManagement.top" prop="heartbeatTop" ref="heartbeatTop">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.heartbeatTop"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @change="changeHeartbeatTop"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.heartTime}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 生命异常检测设置 -->
          <el-row class="facilitySensorSet-b-form" v-if="false">
            <h3>{{facilityManagement.body}}</h3>
            <el-col :span="6">
              <el-form-item :label="facilityManagement.checkTime" prop="bodyCheckTime">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.bodyCheckTime"
                      autocomplete="off"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.minute}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 离床异常检测设置 -->
          <el-row class="facilitySensorSet-b-form">
            <h3>{{facilityManagement.leaveBed}}</h3>
            <el-col :span="6">
              <el-form-item :label="facilityManagement.checkTime" prop="leaveBedCheckTime">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.leaveBedCheckTime"
                      autocomplete="off"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.second}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label=" ">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-colTwo"
                    :span="24"
                    align="left">
                    <p>{{facilityManagement.warningWord}}</p>
                    <p style="line-height: 0;">{{facilityManagement.warningWord2}}</p>
                  </el-col>                 
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

           <!-- 离床检测时间 -->
          <el-row class="facilitySensorSet-b-form" v-if="false">
          <h3>離床後のカメラの監視時間</h3>
          <el-col :span="6">
            <el-form-item label="監視時間設定値" prop="cameraBedTime">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.cameraBedTime"
                      autocomplete="off"
                      :disabled="!isEditor"
                      @input="changeCameraBedTime"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.second}}</el-col>
                </el-row>
              </el-form-item>
          </el-col>
          <el-col :span="10">
          </el-col>
        </el-row>

        <!-- 离床开关 -->
          <el-row class="facilitySensorSet-b-form">
          <h3>離床アラート音</h3>
          <el-col :span="12">
            <el-form-item style="margin-left:30px">
                <el-row class="facilitySensorSet-b-form-row switch">
                  <el-switch
                    v-model="ruleForm.leaveBedSound"
                    :disabled="!isEditor || ruleForm.cameraBedTime == 0"
                    active-text="オン（鳴る）"
                    inactive-text="オフ（鳴らない）">
                  </el-switch>
                </el-row>
              </el-form-item>
          </el-col>
        </el-row>


          <!--来回走动异常检测设置 -->
          <!-- <el-row class="facilitySensorSet-b-form">
          <h4>{{facilityManagement.backOn}}</h4>
          <el-col :span="6">
            <el-form-item :label="facilityManagement.timeStart" prop="backOnTimeStart">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-col" :span="8" align="right">{{facilityManagement.settingTime}}</el-col>
                <el-col :span="8">
                  <el-time-picker
                    v-model="ruleForm.backOnTimeStart"
                    placeholder=""
                    format="HH:mm"
                    value-format="HH:mm"
                    style="width:100px;"
                    :editable="false"
                    :clearable="false"
                    :disabled="!isEditor"
                  >
                  </el-time-picker> 
                </el-col>
              </el-row>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="facilityManagement.timeEnd" prop="backOnTimeEnd">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-col" :span="8" align="right">{{facilityManagement.settingTime}}</el-col>
                <el-col :span="8">
                  <el-time-picker
                    v-model="ruleForm.backOnTimeEnd"
                    placeholder=""
                    format="HH:mm"
                    value-format="HH:mm"
                    style="width:100px;"
                    :editable="false"
                    :clearable="false"
                    :disabled="!isEditor"
                  >
                  </el-time-picker> 
                </el-col>
              </el-row>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="facilitySensorSet-b-form">
          <el-col :span="6">
            <el-form-item :label="facilityManagement.checkTime" prop="backOnCheckTime">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-col" :span="8" align="right">{{facilityManagement.settingTime}}</el-col>
                <el-col :span="8"><el-input v-model.trim="ruleForm.backOnCheckTime" autocomplete="off" :disabled="!isEditor"></el-input></el-col>
                <el-col class="facilitySensorSet-b-form-col" :span="7" align="left">{{facilityManagement.second}}</el-col>
              </el-row>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label=" ">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-colTwo" :span="24" align="left">{{facilityManagement.warningBackOn}}</el-col>
              </el-row>
            </el-form-item>
          </el-col>
          </el-row>-->

          <!-- 摔倒异常设置 -->
          <!-- <el-row class="facilitySensorSet-b-form">
          <h4>{{facilityManagement.fall}}</h4>
          <el-col :span="6">
            <el-form-item :label="facilityManagement.checkFallTime" prop="fallCheckTime">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-col" :span="8" align="right">{{facilityManagement.settingTime}}</el-col>
                <el-col :span="8"><el-input v-model.trim="ruleForm.fallCheckTime" autocomplete="off" :disabled="!isEditor"></el-input></el-col>
                <el-col class="facilitySensorSet-b-form-col" :span="7" align="left">{{facilityManagement.zhen}}</el-col>
              </el-row>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label=" ">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-colTwo" :span="24" align="left">{{facilityManagement.warningFall}}</el-col>
              </el-row>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="facilitySensorSet-b-form">
          <el-col :span="6">
            <el-form-item :label="facilityManagement.unusualCheckTime" prop="cameraCheckTime">
              <el-row class="facilitySensorSet-b-form-row">
                <el-col class="facilitySensorSet-b-form-col" :span="8" align="right">{{facilityManagement.settingTime}}</el-col>
                <el-col :span="8"><el-input v-model.trim="ruleForm.cameraCheckTime" autocomplete="off" :disabled="!isEditor"></el-input></el-col>
                <el-col class="facilitySensorSet-b-form-col" :span="7" align="left">{{facilityManagement.second}}</el-col>
              </el-row>
            </el-form-item>
          </el-col>
          </el-row>-->

          <!-- 警报录像时长设置 -->
          <el-row class="facilitySensorSet-b-form">
            <h3>{{facilityManagement.videoAlarmDuration}}</h3>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.beforeDuration"
                prop="beforeDuration"
                ref="beforeDuration"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.beforeDuration"
                      autocomplete="off"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.second}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.afterDuration"
                prop="afterDuration"
                ref="afterDuration"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.afterDuration"
                      autocomplete="off"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.second}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 転倒アラート間隔時間 -->
          <el-row class="facilitySensorSet-b-form"  v-if="false">
          <h3>転倒アラート間隔時間</h3>
          <el-col :span="6">
            <el-form-item label="アラート間隔時間設定値" prop="fillDuration">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.fillDuration"
                      autocomplete="off"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.second}}</el-col>
                </el-row>
              </el-form-item>
          </el-col>
          <el-col :span="10">
          </el-col>
        </el-row>

          <!-- 夜间巡视时间设置 -->
          <el-row class="facilitySensorSet-b-form">
            <h3>{{facilityManagement.nightPatrolTime}}</h3>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.leaveRoomAlertStartTime"
                prop="leaveRoomAlertStartTime"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-time-picker
                      v-model="ruleForm.leaveRoomAlertStartTime"
                      placeholder
                      format="HH:mm:ss"
                      value-format="HH:mm:ss"
                      style="width:120px;"
                      :editable="false"
                      :clearable="false"
                      :disabled="!isEditor"
                    ></el-time-picker>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                :label="facilityManagement.leaveRoomAlertEndTime"
                prop="leaveRoomAlertEndTime"
              >
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-time-picker
                      v-model="ruleForm.leaveRoomAlertEndTime"
                      placeholder
                      format="HH:mm:ss"
                      value-format="HH:mm:ss"
                      style="width:120px;"
                      :editable="false"
                      :clearable="false"
                      :disabled="!isEditor"
                    ></el-time-picker>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label=" ">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-colTwo"
                    :span="24"
                    align="left"
                  >{{facilityManagement.nightPatrolTimeMsg}}</el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 夜間徘徊アラート間隔時間 -->
          <el-row class="facilitySensorSet-b-form" v-if="false">
          <h3>夜間巡回異常アラートの間隔時間</h3>
          <el-col :span="6">
            <el-form-item label="アラート間隔発報の設定値" prop="leaveDuration">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.leaveDuration"
                      autocomplete="off"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.second}}</el-col>
                </el-row>
              </el-form-item>
          </el-col>
          <el-col :span="10">
          </el-col>
        </el-row>


        <!-- 夜間徘徊アラート遅延時間 -->
          <el-row class="facilitySensorSet-b-form">
          <h3>夜間巡回異常アラートの遅延時間</h3>
          <el-col :span="6">
            <el-form-item label="アラート遅延発報の設定値" prop="leaveRoomDuration">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="8"
                    align="right"
                  >{{facilityManagement.settingTime}}</el-col>
                  <el-col :span="8">
                    <el-input
                      v-model.trim="ruleForm.leaveRoomDuration"
                      autocomplete="off"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.second}}</el-col>
                </el-row>
              </el-form-item>
          </el-col>
          <el-col :span="10">
          </el-col>
        </el-row>
        <!-- 夜間徘徊アラート遅延時間 -->
          <el-row class="facilitySensorSet-b-form">
          <h3>アラート強制停止</h3>
          <el-col :span="12" class="stopDurationitem">
            <el-form-item label="停止时间" prop="continueAlertStop" style="display:flex;margin-left:-8px">
                <el-row class="facilitySensorSet-b-form-row">
                  <el-col :span="10">
                    <el-input
                      v-model.trim="ruleForm.continueAlertStop"
                      autocomplete="off"
                      maxlength="3"
                      :disabled="!isEditor"
                    ></el-input>
                  </el-col>
                  <el-col
                    class="facilitySensorSet-b-form-col"
                    :span="7"
                    align="left"
                  >{{facilityManagement.minute}}</el-col>
                </el-row>
              </el-form-item>
          </el-col>
          <el-col :span="10">
          </el-col>
        </el-row>
          <!-- 设定的提示 -->
          <el-row class="facilitySensorSet-b-form">
            <h4>{{facilityManagement.warningTitle}}</h4>
          </el-row>
        </el-form>
      </el-row>
    </div>


    <!-- 按钮 -->
    <el-row class="facilitySensorSet-c facilitySensorSet-b-btnRow">
      <el-col :span="4">
        <Kt-button
          class="cancelBtn boxShadowButton"
          :size="size"
          :label="facilityManagement.cancel"
          @click="cancel"
        ></Kt-button>
      </el-col>
      <el-col :span="4" align="center">
        <Kt-button
          v-if="!isEditor"
          class="printBtn boxShadowButton"
          :size="size"
          :label="facilityManagement.print"
          @click.native="printSensor"
        ></Kt-button>
      </el-col>
      <el-col :span="4" align="right">
        <Kt-button
          v-if="!isEditor"
          class="editBtn boxShadowButton"
          :size="size"
          :label="facilityManagement.edit"
          @click="handleEdit"
        ></Kt-button>
        <Kt-button
          v-if="isEditor"
          class="submitBtn boxShadowButton"
          :size="size"
          :label="facilityManagement.update"
          @click="submitForm('ruleForm')"
        ></Kt-button>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import KtButton from "@/components/KtButton";
import bus from "../../../vuex/eventBus"; //引入eventBus,接收子界面传递的跳转指令,然后在父界面跳转,添加tab
import juxing_Small from "../../../assets/lifeGroupimg/juxing_small.png";
export default {
  name: "FacilitySensorSet",
  data() {
    return {
      facilityManagement: this.$t("m.facilityManagement"), //引入 lang 里面的字符串资源,
      size: "mini", //按钮的尺寸
      image: { juxing_Small },
      ruleForm: {
        groupId: "",
        //异常检测时间设置
        foucsTime: "", //注意时间
        warningTime: "", //警告时间
        unusualTime: "", //异常时间

        //室温异常检测
        tempBottom: "", //正常温度（下限）
        tempTop: "", //正常温度（下限）
        unusualCheckTime: "", //室温检测时间

        //呼吸异常次数设置
        breathBottom: "", //呼吸次数（下限）
        breathTop: "", //呼吸次数（上限）

        //心跳异常次数设置
        heartbeatBottom: "", //心跳次数（下限）
        heartbeatTop: "", //心跳次数（上限）

        //生命异常检测设置
        bodyCheckTime: "", //生命异常检测时间设置

        //离床异常检测设置
        leaveBedCheckTime: "", //离床异常检测时间设置
        leaveBedSound:false, //new by fzq
        cameraBedTime:'',
        fillDuration:'',
        leaveDuration:'',
        continueAlertStop: '',
        leaveRoomDuration:'', //new by fzq end at 2021.0525
        //来回走动异常检测
        backOnTimeStart: "", //时间（开始）
        backOnTimeEnd: "", //时间（结束）
        backOnCheckTime: "", //来回走动异常检测时间

        //摔倒异常检测
        fallCheckTime: "", //检知回数阈值
        cameraCheckTime: "", //异常检测时间

        //夜间巡视时间
        leaveRoomAlertStartTime: "", //夜间巡视开始时间
        leaveRoomAlertEndTime: "", //夜间巡视结束时间

        //报警时长设置
        beforeDuration: "", //警报前录像时长
        afterDuration: "" //警报后录像时长
      },
      acceptLanguage: "ja_JP", //数据请求传参需要传的语言  ja_JP----日文
      isEditor: false //是否可以编辑 false不能
    };
  },
  methods: {
    /* 
      清除校验
    */
    clearValidate(formName) {
      //formName为传入要清除的prop ，可以是整个form表单，也可以是一个
      this.$refs[formName].clearValidate();
    },
    changeCameraBedTime(val){
      if(val == 0){
        this.ruleForm.leaveBedSound = false;
      }
    },
    /* 
      注意时间清除警告时间和异常时间的错误提示
    */
    changeFoucsTime() {
      if (
        Number(this.ruleForm.foucsTime) < Number(this.ruleForm.warningTime) &&
        Number(this.ruleForm.warningTime) < Number(this.ruleForm.unusualTime)
      ) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("warningTime");
        this.clearValidate("unusualTime");
        //2.分开判断  警告时间  和异常时间
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.warningTime))==true && this.ruleForm.warningTime.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   if(this.ruleForm.warningTime.length>=1 && this.ruleForm.warningTime.length<=4){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.warningTime) === 'number' && !isNaN(this.ruleForm.warningTime)){
        //       //2.1.4不能小于100
        //       if(this.ruleForm.warningTime>=100){
        //         this.clearValidate('warningTime')
        //       }
        //     }
        //   }

        // }
        // //2.2.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.unusualTime))==true && this.ruleForm.unusualTime.indexOf(".")==-1){
        //   //2.2.2判断菜长度
        //   if(this.ruleForm.unusualTime.length>=1 && this.ruleForm.unusualTime.length<=4){
        //     //2.2.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.unusualTime) === 'number' && !isNaN(this.ruleForm.unusualTime)){
        //       //2.1.4不能小于100
        //       if(this.ruleForm.unusualTime>=100){
        //         this.clearValidate('unusualTime')
        //       }
        //     }
        //   }
        // }
      }
    },

    /* 
      警告时间清除注意时间和异常时间的错误提示
    */
    changeWarningTime() {
      if (
        Number(this.ruleForm.foucsTime) < Number(this.ruleForm.warningTime) &&
        Number(this.ruleForm.warningTime) < Number(this.ruleForm.unusualTime)
      ) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("foucsTime");
        this.clearValidate("unusualTime");
        //2.分开判断  注意时间  和异常时间
        //2.1.1判断不能有小数点
        // console.log("jin  111")
        // if(Number.isInteger(Number(this.ruleForm.foucsTime))==true && this.ruleForm.foucsTime.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   console.log("jin  222")
        //   if(this.ruleForm.foucsTime.length>=1 && this.ruleForm.foucsTime.length<=4){
        //     console.log("jin 333")
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.foucsTime) === 'number' && !isNaN(this.ruleForm.foucsTime)){
        //       console.log("jin 444")
        //       //2.1.4不能小于100
        //       if(this.ruleForm.foucsTime>=100){
        //         this.clearValidate('foucsTime')
        //       }
        //     }
        //   }

        // }
        // //2.2.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.unusualTime))==true && this.ruleForm.unusualTime.indexOf(".")==-1){
        //   //2.2.2判断菜长度
        //   if(this.ruleForm.unusualTime.length>=1 && this.ruleForm.unusualTime.length<=4){
        //     //2.2.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.unusualTime) === 'number' && !isNaN(this.ruleForm.unusualTime)){
        //       //2.1.4不能小于100
        //       if(this.ruleForm.unusualTime>=100){
        //         this.clearValidate('unusualTime')
        //       }
        //     }
        //   }
        // }
      }
    },

    /* 
      异常时间清除注意时间和警告时间的错误提示
    */
    changeUnusualTime() {
      //1.先判断三者的大小
      console.log(
        Number(this.ruleForm.foucsTime) < Number(this.ruleForm.warningTime),
        Number(this.ruleForm.warningTime) < Number(this.ruleForm.unusualTime)
      );
      if (
        Number(this.ruleForm.foucsTime) < Number(this.ruleForm.warningTime) &&
        Number(this.ruleForm.warningTime) < Number(this.ruleForm.unusualTime)
      ) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("foucsTime");
        this.clearValidate("warningTime");
        //2.分开判断  注意时间  和警告时间
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.foucsTime))==true && this.ruleForm.foucsTime.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   if(this.ruleForm.foucsTime.length>=1 && this.ruleForm.foucsTime.length<=4){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.foucsTime) === 'number' && !isNaN(this.ruleForm.foucsTime)){
        //       //2.1.4不能小于100
        //       if(this.ruleForm.foucsTime>=100){
        //         this.clearValidate('foucsTime')
        //       }
        //     }
        //   }

        // }
        // //2.2.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.warningTime))==true && this.ruleForm.warningTime.indexOf(".")==-1){
        //   //2.2.2判断菜长度
        //   if(this.ruleForm.warningTime.length>=1 && this.ruleForm.warningTime.length<=4){
        //     //2.2.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.warningTime) === 'number' && !isNaN(this.ruleForm.warningTime)){
        //       //2.1.4不能小于100
        //       if(this.ruleForm.warningTime>=100){
        //         this.clearValidate('warningTime')
        //       }
        //     }
        //   }
        // }
      }
    },

    /* 
      温度下限清除温度上限的错误提示语  
    */
    changeTempBottom() {
      if (Number(this.ruleForm.tempBottom) <= Number(this.ruleForm.tempTop)) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("tempTop");
        //2.分开判断 温度上限
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.tempTop))==true && this.ruleForm.tempTop.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   console.log(this.ruleForm.tempTop.length)
        //   if(this.ruleForm.tempTop.length>=1 && this.ruleForm.tempTop.length<=3){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.tempTop) === 'number' && !isNaN(this.ruleForm.tempTop)){
        //       //2.1.4不能为空
        //       if(this.ruleForm.tempTop!=''){
        //         this.clearValidate('tempTop')
        //       }
        //     }
        //   }

        // }
      }
    },

    /* 
    温度上限清除温度下限的错误提示物
   */
    changeTempTop() {
      if (Number(this.ruleForm.tempBottom) <= Number(this.ruleForm.tempTop)) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("tempBottom");
        //2.分开判断 温度下限
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.tempBottom))==true && this.ruleForm.tempBottom.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   console.log(this.ruleForm.tempBottom.length)
        //   if(this.ruleForm.tempBottom.length>=1 && this.ruleForm.tempBottom.length<=3){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.tempBottom) === 'number' && !isNaN(this.ruleForm.tempBottom)){
        //       //2.1.4不能为空
        //       if(this.ruleForm.tempBottom!=''){
        //         this.clearValidate('tempBottom')
        //       }
        //     }
        //   }

        // }
      }
    },

    /* 
      呼吸下限清除呼吸上限的错误提示语
    */
    changeBreathBottom() {
      if (
        Number(this.ruleForm.breathBottom) <= Number(this.ruleForm.breathTop)
      ) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("breathTop");
        //2.分开判断 呼吸上限
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.breathTop))==true && this.ruleForm.breathTop.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   if(this.ruleForm.breathTop.length>=1 && this.ruleForm.breathTop.length<=3){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.breathTop) === 'number' && !isNaN(this.ruleForm.breathTop)){
        //       //2.1.4不能为空
        //       if(this.ruleForm.breathTop!=''){
        //         if(this.ruleForm.breathTop>0){
        //           this.clearValidate('breathTop')
        //         }
        //       }
        //     }
        //   }

        // }
      }
    },

    /* 
      呼吸上限清除呼吸下限的错误提示语
    */
    changeBreathTop() {
      if (
        Number(this.ruleForm.breathBottom) <= Number(this.ruleForm.breathTop)
      ) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("breathBottom");
        //2.分开判断 呼吸下限
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.breathBottom))==true && this.ruleForm.breathBottom.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   if(this.ruleForm.breathBottom.length>=1 && this.ruleForm.breathBottom.length<=3){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.breathBottom) === 'number' && !isNaN(this.ruleForm.breathBottom)){
        //       //2.1.4不能为空
        //       if(this.ruleForm.breathBottom!=''){
        //         if(this.ruleForm.breathBottom>0){
        //           this.clearValidate('breathBottom')
        //         }
        //       }
        //     }
        //   }

        // }
      }
    },

    /* 
      心跳下限清除心跳上限的错误提示语
    */
    changeHeartbeatBottom() {
      if (
        Number(this.ruleForm.heartbeatBottom) <=
        Number(this.ruleForm.heartbeatTop)
      ) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("heartbeatTop");
        //2.分开判断 心跳上限
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.heartbeatTop))==true && this.ruleForm.heartbeatTop.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   if(this.ruleForm.heartbeatTop.length>=1 && this.ruleForm.heartbeatTop.length<=3){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.heartbeatTop) === 'number' && !isNaN(this.ruleForm.heartbeatTop)){
        //       //2.1.4不能为空
        //       if(this.ruleForm.heartbeatTop!=''){
        //         if(this.ruleForm.heartbeatTop>0){
        //           this.clearValidate('heartbeatTop')
        //         }
        //       }
        //     }
        //   }

        // }
      }
    },

    /* 
      心跳上限清除心跳下限的错误提示语
    */
    changeHeartbeatTop() {
      if (
        Number(this.ruleForm.heartbeatBottom) <=
        Number(this.ruleForm.heartbeatTop)
      ) {
        //by guo 2020-3-28-14:38修改  测试又要求改成这样  只需要判断大小满足就去掉提示语
        this.clearValidate("heartbeatBottom");
        //2.分开判断 心跳下限
        //2.1.1判断不能有小数点
        // if(Number.isInteger(Number(this.ruleForm.heartbeatBottom))==true && this.ruleForm.heartbeatBottom.indexOf(".")==-1){
        //   //2.1.2判断菜长度
        //   if(this.ruleForm.heartbeatBottom.length>=1 && this.ruleForm.heartbeatBottom.length<=3){
        //     //2.1.3判断是否为数字类型
        //     if(typeof Number(this.ruleForm.heartbeatBottom) === 'number' && !isNaN(this.ruleForm.heartbeatBottom)){
        //       //2.1.4不能为空
        //       if(this.ruleForm.heartbeatBottom!=''){
        //         if(this.ruleForm.heartbeatBottom>0){
        //           this.clearValidate('heartbeatBottom')
        //         }
        //       }
        //     }
        //   }

        // }
      }
    },

    /* 
      取消
    */
    cancel() {
      console.log("跳转");
      bus.$emit("homePage", {
        type: "remove",
        path: "/FacilitySensorSet",
        showpath: "/FacilityManagement"
      });
    },

    /* 
      编辑
    */
    handleEdit() {
      this.isEditor = true;
    },

    /* 
      更新
    */
    submitForm(datainfo) {
      console.log(datainfo, "------");
      this.$refs[datainfo].validate(valid => {
        if (valid) {
          let params = {
            groupId: this.ruleForm.groupId,
            toiletAttentionTime: this.ruleForm.foucsTime,
            toiletWarningTime: this.ruleForm.warningTime,
            toiletUnusualTime: this.ruleForm.unusualTime,
            temperatureMinimum: this.ruleForm.tempBottom,
            temperatureMaximum: this.ruleForm.tempTop,
            // temperatureMeasuringTimeInterval: this.ruleForm.unusualCheckTime,//edit by fzq at 20210506 am;delete the value setting default value is 100;
            temperatureMeasuringTimeInterval: 100,
            breathMinTimes: this.ruleForm.breathBottom,
            breathMaxTimes: this.ruleForm.breathTop,
            heartbeatMinimum: this.ruleForm.heartbeatBottom,
            heartbeatMaximum: this.ruleForm.heartbeatTop,
            vitalMeasuringTimeInterval: this.ruleForm.bodyCheckTime,
            leaveBedMeasuringTimeInterval: this.ruleForm.leaveBedCheckTime,
            cameraBedTime: this.ruleForm.cameraBedTime,
            fillDuration: this.ruleForm.fillDuration,
            leaveDuration: this.ruleForm.leaveDuration,
            leaveRoomDuration: this.ruleForm.leaveRoomDuration,
            continueAlertStop: this.ruleForm.continueAlertStop,
            leaveBedSound:this.ruleForm.leaveBedSound?'1':'0',
            walkMeasuringStartTime: this.ruleForm.backOnTimeStart,
            walkMeasuringEndTime: this.ruleForm.backOnTimeEnd,
            walkMeasuringTimeInterval: this.ruleForm.backOnCheckTime,
            tumbleMeasuringFrame: this.ruleForm.fallCheckTime,
            cameraCheckTime: this.ruleForm.cameraCheckTime,
            leaveRoomAlertStartTime: this.ruleForm.leaveRoomAlertStartTime, //by guo 2020-3-5-15:02添加
            leaveRoomAlertEndTime: this.ruleForm.leaveRoomAlertEndTime, //by guo 2020-3-5-15:02添加
            beforeDuration: this.ruleForm.beforeDuration, //by guo 2020-3-6-11:24添加
            afterDuration: this.ruleForm.afterDuration //by guo 2020-3-6-11-24添加
          };
          console.log(params, "----");
          console.log(this.acceptLanguage, "this.acceptLanguage");
          this.$put(
            this.ports.facilityManagement.lifeTransducerConfig,
            params,
            "FORM-DATA",
            this.acceptLanguage
          ).then(res => {
            console.log(res);
            if (res.code == 200) {
              this.$message({ message: res.message, type: "success" });
              bus.$emit("homePage", {
                type: "remove",
                path: "/FacilitySensorSet",
                showpath: "/FacilityManagement"
              });
            } else {
              this.$message({ message: res.message, type: "error" });
            }
          });
        } else {
          console.log("提交失败!");
          this.$message({
            message: this.$t("m.facilityManagement.errorMsg"),
            type: "error"
          });
          return false;
        }
      });
    },

    /* 
      传感器查询默认值
    */
    querySensorSet(groupId) {
      let params = new Object();
      params.groupId = groupId;
      console.log(groupId);
      this.$get(
        this.ports.facilityManagement.querySensorSet,
        params,
        this.acceptLanguage
      ).then(res => {
        console.log(res);
        this.ruleForm.groupId = res.groupId;
        this.ruleForm.foucsTime = String(res.toiletAttentionTime);
        this.ruleForm.warningTime = String(res.toiletWarningTime);
        this.ruleForm.unusualTime = String(res.toiletUnusualTime);
        this.ruleForm.tempBottom = String(res.temperatureMinimum);
        this.ruleForm.tempTop = String(res.temperatureMaximum);
        this.ruleForm.unusualCheckTime = String(
          res.temperatureMeasuringTimeInterval
        );
        this.ruleForm.breathBottom = String(res.breathMinTimes);
        this.ruleForm.breathTop = String(res.breathMaxTimes);
        this.ruleForm.heartbeatBottom = String(res.heartbeatMinimum);
        this.ruleForm.heartbeatTop = String(res.heartbeatMaximum);
        this.ruleForm.bodyCheckTime = String(res.vitalMeasuringTimeInterval);
        this.ruleForm.leaveBedCheckTime = String(
          res.leaveBedMeasuringTimeInterval
        );
        this.ruleForm.cameraBedTime  = String(
          res.cameraBedTime
        );
        this.ruleForm.fillDuration  = String(
          res.fillDuration
        );
        this.ruleForm.leaveDuration  = String(
          res.leaveDuration
        );
        this.ruleForm.leaveRoomDuration  = String(
          res.leaveRoomDuration
        );
        this.ruleForm.continueAlertStop =  String(
          res.continueAlertStop
        );
        this.ruleForm.leaveBedSound = (res.leaveBedSound == 1);

        this.ruleForm.backOnTimeStart = String(res.walkMeasuringStartTime);
        this.ruleForm.backOnTimeEnd = String(res.walkMeasuringEndTime);
        this.ruleForm.backOnCheckTime = String(res.walkMeasuringTimeInterval);
        this.ruleForm.fallCheckTime = String(res.tumbleMeasuringFrame);
        this.ruleForm.cameraCheckTime = String(res.cameraCheckTime);
        this.ruleForm.leaveRoomAlertStartTime = String(
          res.leaveRoomAlertStartTime
        ); //by guo 2020-3-5-15:02添加
        this.ruleForm.leaveRoomAlertEndTime = String(res.leaveRoomAlertEndTime); //by guo 2020-3-5-15-02添加
        this.ruleForm.beforeDuration = String(res.beforeDuration); //by guo 2020-3-6-11:24添加
        this.ruleForm.afterDuration = String(res.afterDuration); //by guo 2020-3-6-11-24添加
        console.log(this.ruleForm);
      });
    },
    printSensor() {
      this.$print(this.$refs.print);
    }
  },
  created() {},
  mounted() {
    let groupId = sessionStorage.getItem("groupId");
    this.querySensorSet(groupId);
  },
  computed: {
    //使用computed计算属性来操作form表单规则的国际化
    rules() {
      //此处的rules 是你声明的名字，参考下图
      var validate_FoucsTime = (rule, value, callback) => {
        //注意时间
        if (Number(value) < 1) {
          callback(new Error(this.$t("m.facilityManagement.time1")));
        } else if (
          Number(value) >= Number(this.ruleForm.warningTime) ||
          Number(value) >= Number(this.ruleForm.unusualTime)
        ) {
          callback(new Error(this.$t("m.facilityManagement.timeLimit")));
        }
        callback();
      };
      var validate_WarningTime = (rule, value, callback) => {
        //警告时间
        if (Number(value) < 1) {
          callback(new Error(this.$t("m.facilityManagement.time1")));
        } else if (
          Number(value) <= Number(this.ruleForm.foucsTime) ||
          Number(value) >= Number(this.ruleForm.unusualTime)
        ) {
          callback(new Error(this.$t("m.facilityManagement.timeLimit")));
        }
        callback();
      };
      var validate_UnusualTime = (rule, value, callback) => {
        //异常时间
        if (this.ruleForm.unusualTime < 1) {
          callback(new Error(this.$t("m.facilityManagement.time1")));
        } else if (
          Number(value) <= Number(this.ruleForm.foucsTime) ||
          Number(value) <= Number(this.ruleForm.warningTime)
        ) {
          callback(new Error(this.$t("m.facilityManagement.timeLimit")));
        }
        callback();
      };
      var validate_UnusualCheckTime = (rule, value, callback) => {
        //室温监测时间间隔
        if (this.ruleForm.unusualCheckTime < 100) {
          callback(new Error(this.$t("m.facilityManagement.time1")));
        } else if (this.ruleForm.unusualCheckTime % 100 != 0) {
          callback(new Error(this.$t("m.facilityManagement.remainder100")));
        }
        callback();
      };
      //生命体征规则
      var minNumber = (rule, value, callback) => {
        if (value < 1) {
          callback(new Error(this.$t("m.facilityManagement.min1")));
        }
        callback();
      };
      //画面帧数规则
      var warningFallRule = (rule, value, callback) => {
        if (value < 0 || (value > 0 && value < 5)) {
          callback(new Error(this.$t("m.facilityManagement.minhua5")));
        }
        callback();
      };
      //画面帧数规则
      var cameraCheckTime = (rule, value, callback) => {
        if (value < 0 || (value > 0 && value < 5)) {
          callback(new Error(this.$t("m.facilityManagement.minhua5")));
        }
        callback();
      };
      //只能为number
      var isNumber = (rule, value, callback) => {
        let newValue = Number(value);
        if (typeof newValue === "number" && !isNaN(value)) {
        } else {
          callback(new Error(this.$t("m.facilityManagement.number")));
        }
        callback();
      };
      //在1到10之间
      var max10 = (rule, value, callback) => {
        if (value >= 1 && value <= 10) {
        } else {
          callback(new Error(this.$t("m.facilityManagement.max10")));
        }
        callback();
      };
      //在1到10之间
      var minmax200 = (rule, value, callback) => {
        if (value >= 3*60 && value <= 6*60) {
        } else {
          callback(new Error(this.$t("m.facilityManagement.minmax200")));
        }
        callback();
      };
      //警报前录像时长小于等于120  by guo 2020-4-14-15:31修改  小于等于120s
      var max30_1 = (rule, value, callback) => {
        if (value > 120) {
          callback(new Error(this.$t("m.facilityManagement.max30_1")));
        }
        callback();
      };
      var min15 = (rule, value, callback) => {
        if (value < 15) {
          callback(new Error(this.$t("m.facilityManagement.min15")));
        }
        callback();
      };
      var max120 = (rule, value, callback) => {
        if (value > 120) {
          callback(new Error(this.$t("m.facilityManagement.max120")));
        }
        callback();
      };
      //警报后录像时长小于等于30
      var max30_2 = (rule, value, callback) => {
        if (value > 30) {
          callback(new Error(this.$t("m.facilityManagement.max30_2")));
        }
        callback();
      };
      //大于0
      var min0 = (rule, value, callback) => {
        if (value < 0) {
          callback(new Error(this.$t("m.facilityManagement.min0")));
        }
        callback();
      };
      //温度下限
      var validate_TempBottom = (rule, value, callback) => {
        console.log(this.ruleForm.tempTop, "==", value);
        if (this.ruleForm.tempTop != "") {
          if (Number(value) > Number(this.ruleForm.tempTop)) {
            callback(new Error(this.$t("m.facilityManagement.minTempTop")));
          } else if (Number(value) < 10) {
            callback(new Error(this.$t("m.facilityManagement.minTempTop2")));
          }
        }
        callback();
      };
      //温度上限
      var validate_TempTop = (rule, value, callback) => {
        console.log(this.ruleForm.tempBottom, "--", value);
        if (this.ruleForm.tempBottom != "") {
          if (Number(value) < Number(this.ruleForm.tempBottom)) {
            callback(new Error(this.$t("m.facilityManagement.minTempBottom")));
          } else if (Number(value) > 30) {
            callback(new Error(this.$t("m.facilityManagement.minTempBottom2")));
          }
        }
        callback();
      };
      //呼吸下限
      var validate_BreathBottom = (rule, value, callback) => {
        console.log(this.ruleForm.breathTop, "--");
        if (this.ruleForm.breathTop != "") {
          if (Number(value) > Number(this.ruleForm.breathTop)) {
            callback(new Error(this.$t("m.facilityManagement.minBreathTop")));
          }
        }
        callback();
      };
      //呼吸上限
      var validate_BreathTop = (rule, value, callback) => {
        console.log(this.ruleForm.breathTopbreathBottom, "==", value);
        if (this.ruleForm.breathBottom != "") {
          if (Number(value) < Number(this.ruleForm.breathBottom)) {
            callback(
              new Error(this.$t("m.facilityManagement.minBreathBottom"))
            );
          }
        }
        callback();
      };
      //心跳下限
      var validate_HeartbeatBottom = (rule, value, callback) => {
        console.log(this.ruleForm.heartbeatTop, "--");
        if (this.ruleForm.heartbeatTop != "") {
          if (Number(value) > Number(this.ruleForm.heartbeatTop)) {
            callback(
              new Error(this.$t("m.facilityManagement.minHeartbeatTop"))
            );
          }
        }
        callback();
      };
      //心跳上限
      var validate_HeartbeatTop = (rule, value, callback) => {
        console.log(this.ruleForm.heartbeatBottom, "==", value);
        if (this.ruleForm.heartbeatBottom != "") {
          if (Number(value) < Number(this.ruleForm.heartbeatBottom)) {
            callback(
              new Error(this.$t("m.facilityManagement.minHeartbeatBottom"))
            );
          }
        }
        callback();
      };
      //整数的校验  by guo 2020-2-20 15:00添加
      var validate_int = (rule, value, callback) => {
        //(Number.isInteger(3) true
        //(Number.isInteger(3.3) false
        if (
          Number.isInteger(Number(value)) == false ||
          value.indexOf(".") != -1
        ) {
          callback(new Error(this.$t("m.facilityManagement.int")));
        }
        callback();
      };
      return {
        facilityManagement: this.$t("m.facilityManagement"), //引入 lang 里面的字符串资源,
        //注意此处的return，别忘记了
        foucsTime: [
          { required: true, validator: validate_FoucsTime, trigger: "blur" },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 4,
            message: this.$t("m.facilityManagement.length4"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        warningTime: [
          { required: true, validator: validate_WarningTime, trigger: "blur" },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 4,
            message: this.$t("m.facilityManagement.length4"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        unusualTime: [
          { required: true, validator: validate_UnusualTime, trigger: "blur" },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 4,
            message: this.$t("m.facilityManagement.length4"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        tempBottom: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          { validator: validate_TempBottom, trigger: "blur" },
          // {
          //   validator: min0,
          //    trigger: "blur"
          // },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        tempTop: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          { required: true, validator: validate_TempTop, trigger: "blur" },
          // {
          //   validator: min0,
          //    trigger: "blur"
          // },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        unusualCheckTime: [
          {
            required: true,
            validator: validate_UnusualCheckTime,
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            min: 3,
            max: 5,
            message: this.$t("m.facilityManagement.length3_5"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        breathBottom: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          { validator: validate_BreathBottom, trigger: "blur" },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        breathTop: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          { validator: validate_BreathTop, trigger: "blur" },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        heartbeatBottom: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          { validator: validate_HeartbeatBottom, trigger: "blur" },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        heartbeatTop: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          { validator: validate_HeartbeatTop, trigger: "blur" },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        bodyCheckTime: [
          { required: true, validator: minNumber, trigger: "blur" },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        leaveBedCheckTime: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        cameraBedTime: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        fillDuration: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        leaveDuration: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        continueAlertStop: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: minmax200,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        leaveRoomDuration: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        backOnTimeStart: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          }
        ],
        backOnTimeEnd: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          }
        ],
        backOnCheckTime: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min0,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        fallCheckTime: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          { required: true, validator: warningFallRule, trigger: "blur" },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            min: 1,
            max: 3,
            message: this.$t("m.facilityManagement.length3"),
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        cameraCheckTime: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: max10,
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        //by guo 2020-3-5-14:39添加  夜间巡视开始时间和夜间巡视结束时间
        leaveRoomAlertStartTime: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          }
        ],
        leaveRoomAlertEndTime: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          }
        ],
        //by guo 2020-3-6-10:56添加  警报前录像时长
        beforeDuration: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min15,
            trigger: "blur"
          },
          // {
          //   min: 1,
          //   max: 3,
          //   message: this.$t("m.facilityManagement.length3"),
          //   trigger: "blur"
          // },
          //by guo 2020-4-1-18:58修改
          {
            validator: max120,
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ],
        afterDuration: [
          {
            required: true,
            message: this.$t("m.facilityManagement.empty"),
            trigger: "blur"
          },
          {
            validator: isNumber,
            trigger: "blur"
          },
          {
            validator: min15,
            trigger: "blur"
          },
          // {
          //   min: 1,
          //   max: 3,
          //   message: this.$t("m.facilityManagement.length3"),
          //   trigger: "blur"
          // },
          //by guo 2020-4-1-18:58修改
          {
            validator: max120,
            trigger: "blur"
          },
          {
            validator: validate_int,
            trigger: "blur"
          }
        ]
      };
    }
  },
  components: {
    KtButton
  }
};
</script>
<style lang="scss" scoped>
.facilitySensorSet {
  // min-width:1000px;
  padding-bottom: 20px;
  .height40 {
    height: 40px;
    line-height: 40px;
    .height40-span {
      display: inline-block;
      height: 40px;
      line-height: 40px;
      font-size: 18px;
      font-weight: 700;
      img {
        vertical-align: middle;
        margin-right: 15px;
      }
    }
  }
  .facilitySensorSet-b {
    width: 100%;
    padding: 10px 30px 40px 30px;
    .facilitySensorSet-b-form {
      .facilitySensorSet-b-form-row {
        .facilitySensorSet-b-form-col {
          height: 40px;
          line-height: 40px;
        }
        .facilitySensorSet-b-form-colTwo {
          height: 40px;
          line-height: 40px;
          // color:#0000ff;
          color: rgb(255, 0, 0); //by guo 2020-3-18-18:24修改
        }
      }
    }
    .facilitySensorSet-b-btnRow {
      margin: 30px 0;
    }
  }
  .facilitySensorSet-c {
    padding: 0px 30px 40px 30px;
    /* 取消按钮  修改样式 添加阴影 */
    .cancelBtn {
      background: #dddddd;
      color: #010101;
    }
    .printBtn {
      background: #409eff;
      color: #ffffff;
    }
    /* 编辑按钮  修改样式  添加阴影 */
    .editBtn {
      background: #e6a23c;
      color: #ffffff;
    }

    /* 更新按钮  修改样式  添加阴影 */
    .submitBtn {
      background: #f56c6c;
      color: #ffffff;
    }
  }
}
/deep/ .el-switch.is-disabled{
  opacity: 1;
}
/* 修改element-ui input文本框默认的样式 */
/deep/ .facilitySensorSet-b .el-input__inner {
  border: none !important;
  border-radius: 0px !important;
  border-bottom: 1px solid #999999 !important;
  //background-color: #f6f6f6 !important;
  background-color: transparent !important;
  height: 30px !important;
}

/* 修改每一个form表单小项的margin */
/deep/ .facilitySensorSet-b .el-form-item {
  margin-bottom: 42px !important;
}

/* 修改element-ui 表格label的样式 */
/deep/ .facilitySensorSet-b .el-form-item__label {
  padding: 0 0 0px !important;
  line-height: 10px !important;
  color: #0000ff !important;
  margin-left: 7%;
}
/* 修改form表单每一个小项错误提示的样式 */
/deep/ .facilitySensorSet-b .el-form-item__error {
  left: 12% !important;
}
/deep/ .switch .el-switch__label *{
  font-size: 13px;
}
/deep/ .stopDurationitem .el-form-item__label{
  margin-top: 15px;
  margin-right: 10px;
}
.show {
  display: none;
}
.hide {
  display: block;
}
</style>